<?php
namespace app\core\controller;
use app\core\controller\Error;

/**
 * @title API
 * @description 统一入口
 */
class core
{
    private $in,$re;

    function __construct()
    {
        //加载Error类
        $this->re = new Error();
    }
    /**
     * 统一输入
     * @param $method
     * @return mixed|string
     */
    public function auto(){
//        origin();//跨域
        //接收数据
        $req = Request::instance();
        //接收头部信息
        $head = $req->header();

//        return $head;
        //接收BODY原始加密数据
        $data = $req->param('param');
        //写入请求日志
        $this->re->LOG($data,'openssl:');
        //解密
        $this->in = json_decode(sslDe($data,'pi'),true);

        //写入请求日志
        $this->re->LOG(json_encode($this->in),'request:');
        //提交方式判断
        if($req->method() != strtoupper($method)){
            return $this->re->out('999996');
        }
        return true;
    }
}
